﻿<%@ Page Title="" Language="VB" MasterPageFile="~/AMLO/MasterPageAMLO.master" AutoEventWireup="false" CodeFile="rptAmlo.aspx.vb" Inherits="AMLO_rptAmlo" %>

<%@ Register assembly="DevExpress.Web.v14.1, Version=14.1.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxUploadControl" tagprefix="dx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
     <script type="text/javascript">
         $(document).ready(function () {

             Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
             $("input[id$=txtDateStart]").datepicker($.extend({}, $.datepicker.regional['th'], {
                 yearAddToDisplay: 543,
                 dateFormat: 'dd/mm/yy',
                 showOn: "button",
                 buttonImage: "../img/calendar.gif",
                 buttonImageOnly: true
             }));
             $("input[id$=txtDateEnd]").datepicker($.extend({}, $.datepicker.regional['th'], {
                 yearAddToDisplay: 543,
                     dateFormat: 'dd/mm/yy',
                     showOn: "button",
                     buttonImage: "../img/calendar.gif",
                     buttonImageOnly: true
                 }));

             function EndRequestHandler(sender, args) {
                 $("input[id$=txtDateStart]").datepicker($.extend({}, $.datepicker.regional['th'], {
                     yearAddToDisplay: 543,
                     dateFormat: 'dd/mm/yy',
                     showOn: "button",
                     buttonImage: "../img/calendar.gif",
                     buttonImageOnly: true
                 }));
                 $("input[id$=txtDateEnd]").datepicker($.extend({}, $.datepicker.regional['th'], {
                     yearAddToDisplay: 543,
                     dateFormat: 'dd/mm/yy',
                     showOn: "button",
                     buttonImage: "../img/calendar.gif",
                     buttonImageOnly: true
                 }));
             }

         });


         var hasSubmitted = 0;
         function NoDoubleSubmit() {
             var divMsg = document.getElementById('Processing');
             if (hasSubmitted == 0) {
                 hasSubmitted = 0;
                 divMsg.style.display = 'block';
                 return true;
             }
             return false;
         }

         var prm = Sys.WebForms.PageRequestManager.getInstance();

         prm.add_initializeRequest(InitializeRequest);
         prm.add_endRequest(EndRequest);

         function InitializeRequest(sender, args) {
             $get('ContentPlaceHolder1_UpdatePanel1').style.cursor = 'wait';
         }

         function EndRequest(sender, args) {
             $get('ContentPlaceHolder1_UpdatePanel1').style.cursor = 'auto';
         }

</script>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table style="width:100%;">
                <tr>
                    <td align="left" valign="top" colspan="6">
                        <asp:RadioButtonList ID="rdolTypeApp" runat="server" 
                            RepeatDirection="Horizontal" Width="350px" AutoPostBack="True">
                            <asp:ListItem Value="1">รายงาน</asp:ListItem>
                            <asp:ListItem Value="2">สร้าง XML ไฟล์</asp:ListItem>
                            <asp:ListItem Value="3">ยืนยันการส่ง</asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="width: 100px" valign="top">
                        รายงาน
                    </td>
                    <td align="left" style="width: 290px" valign="top">
                        <asp:DropDownList ID="ddlRrptType" runat="server" Width="155px" 
                            AutoPostBack="True">
                            <asp:ListItem Value="1">ป.ป.ง.01</asp:ListItem>
                            <asp:ListItem Value="2">ป.ป.ง.02</asp:ListItem>
                            <asp:ListItem Value="3">ป.ป.ง.03</asp:ListItem>
                            <asp:ListItem Value="4">ป.ป.ง.1-05-9</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                    <td align="right" valign="top" style="width: 100px">
                        <asp:Label ID="lblTransType" runat="server" CssClass="control">ประเภทธุรกรรม</asp:Label>
                    </td>
                    <td align="left" colspan="3" valign="top">
                        <asp:DropDownList ID="ddlTransType" runat="server" AutoPostBack="True" 
                            CssClass="control" Width="300px">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="top" style="width: 100px">
                        <asp:Label ID="lblDept" runat="server" CssClass="control">ฝ่าย</asp:Label>
                    </td>
                    <td align="left" valign="top" style="width: 282px">
                        <asp:DropDownList ID="ddlDepartment" runat="server" AutoPostBack="True" 
                            CssClass="control" Width="196px">
                        </asp:DropDownList>
                    </td>
                    <td align="right" valign="top">
                        <asp:Label ID="lblBranch" runat="server" CssClass="control">ส่วนงานสาขา</asp:Label>
                    </td>
                    <td align="left" valign="top" >
                        <asp:DropDownList ID="ddlBranch" runat="server" CssClass="control" 
                            Width="200px">
                        </asp:DropDownList>
                    </td>
               <td align="left" valign="top">
                   <asp:Label ID="lblNo" runat="server">เลขที่</asp:Label>
                 </td>
                  <td align="left" valign="top">
                      <asp:TextBox ID="txtNo" runat="server" CssClass="control" Height="20px" 
                          Width="160px" AutoCompleteType="Disabled"></asp:TextBox>
                 </td>
                </tr>
                <tr>
                    <td align="right" valign="top" style="width: 100px">
                        &nbsp;</td>
                    <td align="left" valign="top" style="width: 282px">
                        <asp:RadioButtonList ID="rdolTypeDate" runat="server" CssClass="control" 
                            RepeatDirection="Horizontal" Width="229px">
                            <asp:ListItem Value="1">วันที่ทำธุรกรรม</asp:ListItem>
                            <asp:ListItem Value="2">วันที่บันทึก</asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                    <td align="right" valign="top">
                        <asp:Label ID="lbltransactionDate" runat="server" CssClass="control">วันที่</asp:Label>
                    </td>
                    <td align="left" valign="top" style="width: 180px">
                        <asp:TextBox ID="txtDateStart" runat="server" CssClass="control" Height="20px" 
                            Width="140px" AutoCompleteType="Disabled"></asp:TextBox>
                    </td>
                    <td align="right" valign="top" style="width: 40px">
                        <asp:Label ID="lblTo" runat="server" Text="ถึง"></asp:Label>
                    </td>
                    <td align="left" valign="top">
                        <asp:TextBox ID="txtDateEnd" runat="server" CssClass="control" Height="20px" 
                            Width="140px" AutoCompleteType="Disabled"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="top" style="width: 100px">
                        <asp:Label ID="lblsignType" runat="server" CssClass="control" 
                            Text="การลงลายมือชื่อ"></asp:Label>
                        <asp:Label ID="lblUserConfirm" runat="server" CssClass="control" Text="สาขายืนยัน" />
                    </td>
                    <td align="left" valign="top" style="width: 282px">
                        <asp:RadioButtonList ID="rdolSignType" runat="server" CssClass="control" 
                            RepeatDirection="Horizontal">
                            <asp:ListItem Value="0">ทั้งหมด</asp:ListItem>
                            <asp:ListItem Value="1">ลงลายมือชื่อ</asp:ListItem>
                            <asp:ListItem Value="2">ไม่ลงลายมือชื่อ</asp:ListItem>
                        </asp:RadioButtonList>
                        <asp:RadioButtonList ID="rdoUserConfirm" runat="server" CssClass="control"
                            RepeatDirection="Horizontal">
                            <asp:ListItem Value="-1">ทั้งหมด</asp:ListItem>
                            <asp:ListItem Value="0">ยังไม่ตอบ</asp:ListItem>
                            <asp:ListItem Value="1">ยืนยัน</asp:ListItem>
                            <asp:ListItem Value="2">ขอลบ</asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                    <td align="right" valign="top">
                        <asp:Label ID="lblIsSend" runat="server" CssClass="control" 
                            Text="การส่งข้อมูล"></asp:Label>
                    </td>
                    <td align="left" colspan="3" valign="top">
                        <asp:RadioButtonList ID="rdolIsSend" runat="server" CssClass="control" 
                            RepeatDirection="Horizontal">
                            <asp:ListItem Value="0">ทั้งหมด</asp:ListItem>
                            <asp:ListItem Value="1">ส่งข้อมูลแล้ว</asp:ListItem>
                            <asp:ListItem Value="2">ยังไม่ส่งข้อมูล</asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: right">
                        <asp:Button ID="btnSearch" runat="server" CssClass="control" Text="ค้นหา" 
                            Width="90px" />
                        <asp:Button ID="btnPrint" runat="server" CssClass="control" Text="ออกรายงาน" 
                            Width="90px" />
                        <asp:Button ID="btnPrintFull" runat="server" CssClass="control" Text="ออกรายงานฉบับเต็ม" 
                            Width="140px" />
                        <asp:Button ID="btnPrint1" runat="server" CssClass="control" Text="ออกรายงานฉบับย่อ 1" 
                            Width="140px" />
                        <asp:Button ID="btnPrint2" runat="server" CssClass="control" Text="ออกรายงานฉบับย่อ 2" 
                            Width="140px" />
                        <asp:Button ID="btnGenXML" runat="server"  AutoPostBack="false" CssClass="control" Text="GenXML" 
                            Width="90px" />
                        <asp:Button ID="btnGenXMLACID" runat="server"  AutoPostBack="false" CssClass="control" Text="GenXML แบบมีผู้ร่วม" 
                            Width="160px" />
                        <asp:Button ID="btnGenXMLNoACID" runat="server"  AutoPostBack="false" CssClass="control" Text="GenXML แบบไม่มีผู้ร่วม" 
                            Width="160px" />
                        <asp:Button ID="btnGenCtlFile" runat="server"  AutoPostBack="false" CssClass="control" Text="สร้าง Control File" 
                            Width="140px" /> 
    
                        <asp:Button ID="btnGenXMLShort" runat="server" AutoPostBack="false" 
                            CssClass="control" Text="GenXML แบบเดิม" Width="120px" />
    
                        <asp:Button ID="btnComplete" runat="server" CssClass="control" 
                            Text="ยืนยันการส่ง" Width="90px" />
                    </td>
 
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center">
                        <asp:Label ID="lblMsg" runat="server" Font-Bold="True" Font-Size="XX-Large" 
                            ForeColor="Red" Text="ไม่พบข้อมูล" Visible="False" Height="35px"></asp:Label>
             <SPAN id="Processing" style="DISPLAY: none">
 <img src="../img/icon/ajax-loader.gif" alt="Please wait" />
            กรุณารอสักครู่ ระบบกำลังค้นหาข้อมูล...
  </SPAN>
                    </td>
                </tr>
                <tr>
                    <td colspan="6">
                        <asp:GridView ID="grdAmlo" runat="server" 
                            AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" 
                            style="margin-right: 0px; margin-bottom: 0px;" Width="100%">
                            <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                            <Columns>
                                <asp:CommandField ButtonType="Image" 
                                    SelectImageUrl="~/img/icon/select_icon.gif" ShowSelectButton="True" 
                                    Visible="False">
                                <ItemStyle Width="5%" />
                                </asp:CommandField>
                                <asp:TemplateField HeaderText="VER\SEND">
                                    <ItemTemplate>
                                        <asp:Label ID="Label2" runat="server" Text='<%# eval("RPTREV") %>'></asp:Label>
                                        <asp:Label ID="Label7" runat="server" Text="/"></asp:Label>
                                        <asp:Label ID="Label8" runat="server" 
                                            Text='<%# iif(eval("issend")=false," ","Y") %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:BoundField DataField="RPTNO" HeaderText="เลขที่">
                                <ItemStyle HorizontalAlign="Left" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="ชื่อ">
                                    <ItemTemplate>
                                        <asp:Label ID="Label1" runat="server" 
                                            Text='<%# eval("FirstName") & " " & eval("LastName") %>'></asp:Label>
                                        <asp:HiddenField ID="hdfRptSeq" runat="server" Value='<%# eval("rptseq") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="transDate" DataFormatString="{0:d}" 
                                    HeaderText="วันที่ทำธุรกรรม" />
                                <asp:TemplateField HeaderText="ชนิดธุรกรรม">
                                    <ItemTemplate>
                                        <asp:Label ID="Label3" runat="server" Text='<%# eval("transType") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ลงชื่อ">
                                    <ItemTemplate>
                                        <asp:Label ID="Label4" runat="server" 
                                            Text='<%# iif(eval("signtype")=1,"Y","") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ผู้บันทึก">
                                    <ItemTemplate>
                                        <asp:Label ID="Label5" runat="server" 
                                            Text='<%# eval("BranchCode") & "  " & eval("UpdateBy") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ลบ/อนุมัติ" Visible="False">
                                    <ItemTemplate>
                                        <asp:Label ID="Label9" runat="server" Text=" "></asp:Label>
                                        <asp:Label ID="Label10" runat="server" Text=" "></asp:Label>
                                        <asp:Label ID="Label11" runat="server"></asp:Label>
                                        <asp:Label ID="Label6" runat="server" Text="/"></asp:Label>
                                        <asp:Label ID="Label12" runat="server"></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Gen Xml">
                                    <HeaderTemplate>
                                        <asp:CheckBox ID="chkAll_GenXml" runat="server" 
                                            oncheckedchanged="chkAll_GenXml_CheckedChanged" Text="Gen Xml" 
                                            AutoPostBack="True" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:CheckBox ID="CheckBox1" runat="server" />
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ยืนยัน">
                                    <HeaderTemplate>
                                        <asp:CheckBox ID="chkAll_Confirm" runat="server" AutoPostBack="True" 
                                            oncheckedchanged="chkAll_Confirm_CheckedChanged" Text="ยืนยัน" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:CheckBox ID="CheckBox2" runat="server" />
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                            </Columns>
                            <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" Font-Size="Large" />
                            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                            <HeaderStyle BackColor="#FF9933" Font-Bold="True" ForeColor="White" />
                            <AlternatingRowStyle BackColor="White" />
                        </asp:GridView>
                        <asp:GridView ID="grdAmlo1059" runat="server" 
                            AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" 
                            style="margin-right: 0px; margin-bottom: 0px;" Width="100%">
                            <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                            <Columns>
                                <asp:CommandField ButtonType="Image" 
                                    SelectImageUrl="~/img/icon/select_icon.gif" ShowSelectButton="True" 
                                    Visible="False">
                                <ItemStyle Width="5%" />
                                </asp:CommandField>
                                <asp:TemplateField HeaderText="VER/SEND">
                                    <ItemTemplate>
                                        <asp:Label ID="Label2" runat="server" Text='<%# eval("RPTREV") %>'></asp:Label>
                                        <asp:Label ID="Label7" runat="server" Text="/"></asp:Label>
                                        <asp:Label ID="Label8" runat="server" 
                                            Text='<%# iif(eval("issend")=false," ","Y") %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:BoundField DataField="P3_TRANS_DATE" DataFormatString="{0:d}" 
                                    HeaderText="วันที่ทำธุรกรรม" ItemStyle-HorizontalAlign="Center" />
                                <asp:TemplateField HeaderText="ประเภทธุรกรรม">
                                    <ItemTemplate>
                                        <asp:Label ID="lblTransCode" runat="server" Text='<%# "(" & eval("KEY_FLG") & ") " & eval("P3_TRAN_CODE") %>' CssClass="control" />
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" Width="120px" />
                                </asp:TemplateField>
                                <asp:BoundField DataField="INIT_SOL_ID" HeaderText="SOL_ID">
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="เลขที่เอกสาร">
                                    <ItemTemplate>
                                        <asp:HiddenField ID="hdfId" runat="server" Value='<%# eval("ID") %>' />
                                        <asp:Label ID="lblDocNo" runat="server" Text='<%# eval("DCN_DOCUMENTNO") %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:BoundField DataField="P3_TRAN_ID" HeaderText="Transaction ID">
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:BoundField>
                                <asp:TemplateField HeaderText="ผู้โอน">
                                    <ItemTemplate>
                                        <asp:Label ID="lblSendAcid" runat="server" Text='<%# "เลขที่บัญชี : " & eval("P3_FORACID")%>'></asp:Label>
                                        <br />
                                        <asp:Label ID="lblSendName" runat="server" 
                                            Text='<%# "ชื่อ : " & eval("P3_CUST_NAME") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ผู้รับโอน">
                                    <ItemTemplate>
                                        <asp:Label ID="lblReceiveAcid" runat="server" Text='<%# "เลขที่บัญชี : " & eval("P3_FORACID2")%>'></asp:Label>
                                        <br />
                                        <asp:Label ID="lblReceiveName" runat="server" 
                                            Text='<%# "ชื่อ : " & eval("P3_CUST_NAME2") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="P3_TRAN_AMT" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right"
                                    HeaderText="จำนวนเงิน" />
                                <asp:TemplateField HeaderText="สาขายืนยัน">
                                    <ItemTemplate>
                                        <asp:Label ID="lblIsUserConfirm" runat="server" 
                                            Text='<%# iif(eval("isconfirm")="0","-","") & iif(eval("isconfirm")="1","Y","") %>'></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ผู้บันทึก">
                                    <ItemTemplate>
                                        <asp:Label ID="Label5" runat="server" 
                                            Text='<%# iif(isDBNull(eval("UpdateBy")),eval("CreateBy"),eval("UpdateBy")) %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ลบ/อนุมัติ" Visible="False">
                                    <ItemTemplate>
                                        <asp:Label ID="Label9" runat="server" Text=" "></asp:Label>
                                        <asp:Label ID="Label10" runat="server" Text=" "></asp:Label>
                                        <asp:Label ID="Label11" runat="server"></asp:Label>
                                        <asp:Label ID="Label6" runat="server" Text="/"></asp:Label>
                                        <asp:Label ID="Label12" runat="server"></asp:Label>
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Gen Xml">
                                    <HeaderTemplate>
                                        <asp:CheckBox ID="chkAll_GenXml" runat="server" 
                                            oncheckedchanged="chkAll_GenXml1059_CheckedChanged" Text="Gen Xml" 
                                            AutoPostBack="True" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:CheckBox ID="CheckBox1" runat="server" />
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="ยืนยัน">
                                    <HeaderTemplate>
                                        <asp:CheckBox ID="chkAll_Confirm" runat="server" AutoPostBack="True" 
                                            oncheckedchanged="chkAll_Confirm1059_CheckedChanged" Text="ยืนยัน" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:CheckBox ID="CheckBox2" runat="server" />
                                    </ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" />
                                </asp:TemplateField>
                            </Columns>
                            <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" Font-Size="Large" />
                            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
                            <HeaderStyle BackColor="#FF9933" Font-Bold="True" ForeColor="White" />
                            <AlternatingRowStyle BackColor="White" />
                        </asp:GridView>
                    </td>
                </tr>
                <tr>
                    <td align="right" colspan="6" style="height: 24px">
                        <asp:Label ID="lblTotal" runat="server" Font-Bold="True" 
                            ForeColor="#003300"></asp:Label>
                    </td>
                </tr>
            </table>
        </ContentTemplate>
        <Triggers>
               <asp:PostBackTrigger ControlID="btnGenXML" />
               <asp:PostBackTrigger ControlID="btnGenXMLShort" />
               <asp:PostBackTrigger ControlID="btnGenXMLACID" />
               <asp:PostBackTrigger ControlID="btnGenXMLNoACID" />
               <asp:PostBackTrigger ControlID="btnGenCtlFile" />
        </Triggers>
                        

    </asp:UpdatePanel>
</asp:Content>

